package app_config

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	JwtToken
	SendSmsCode
	Pamela
}

type JwtToken struct {
	AccessSecret string
	AccessExpire int64
}

type SendSmsCode struct {
	AccessKeyId     string
	AccessKeySecret string
}

type Pamela struct {
	PrivateKey string
	APPID      string
}

var AppConf AppConfig

func InitApp() {
	viper.SetConfigFile("./app_config/app.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("动态配置文件获取失败", err)
		return
	}
	viper.Unmarshal(&AppConf)
	fmt.Println("动态配置文件获取成功", AppConf)
}
